using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using System.Data.SqlTypes;
namespace BusinessObjects.BO_GetObjects {
    public static class BO_portal_members {
        public static DataTable SelectAll(int status) {
            try {
                usp_portal_members_select_all entity = new usp_portal_members_select_all();
                entity.STATUS = status;
                return BO_Actions<usp_portal_members_select_all>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status) {
            try {
                usp_portal_members_select_top entity = new usp_portal_members_select_top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return BO_Actions<usp_portal_members_select_top>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Search(int member_id) {
            try {
                usp_portal_members_search entity = new usp_portal_members_search();
                entity.MEMBER_ID = member_id;

                return BO_Actions<usp_portal_members_search>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status) {
            try {
                usp_portal_members_select_paged entity = new usp_portal_members_select_paged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_members_select_paged>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Insert(int region_id, string member_code, string verify_code, string user_name, string pass_word, string avatar_img, string full_name, string email, string mobile, bool gender, string company, string address, DateTime birth_day, string nick_chat, SqlDateTime vip_start_time, SqlDateTime vip_end_time, bool is_vip, bool is_activated, int total_deals, int total_comments, int total_sms, decimal total_money, SqlDateTime first_logged_in, SqlDateTime last_logged_in, bool is_locked, SqlDateTime locked_date, string locked_by, string reason_locked, SqlDateTime unlock_date, string unlock_by, string reason_unlock, DateTime created_date, string created_by, SqlDateTime modify_date, string modify_by, int status) {
            try {
                usp_portal_members_insert entity = new usp_portal_members_insert();
                entity.REGION_ID = region_id;
                entity.MEMBER_CODE = member_code;
                entity.VERIFY_CODE = verify_code;
                entity.USER_NAME = user_name;
                entity.PASS_WORD = pass_word;
                entity.AVATAR_IMG = avatar_img;
                entity.FULL_NAME = full_name;
                entity.EMAIL = email;
                entity.MOBILE = mobile;
                entity.GENDER = gender;
                entity.COMPANY = company;
                entity.ADDRESS = address;
                entity.BIRTH_DAY = birth_day;
                entity.NICK_CHAT = nick_chat;
                entity.VIP_START_TIME = vip_start_time;
                entity.VIP_END_TIME = vip_end_time;
                entity.IS_VIP = is_vip;
                entity.IS_ACTIVATED = is_activated;
                entity.TOTAL_DEALS = total_deals;
                entity.TOTAL_COMMENTS = total_comments;
                entity.TOTAL_SMS = total_sms;
                entity.TOTAL_MONEY = total_money;
                entity.FIRST_LOGGED_IN = first_logged_in;
                entity.LAST_LOGGED_IN = last_logged_in;
                entity.IS_LOCKED = is_locked;
                entity.LOCKED_DATE = locked_date;
                entity.LOCKED_BY = locked_by;
                entity.REASON_LOCKED = reason_locked;
                entity.UNLOCK_DATE = unlock_date;
                entity.UNLOCK_BY = unlock_by;
                entity.REASON_UNLOCK = reason_unlock;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_members_insert>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Update(Int64 member_id, int region_id, string member_code, string verify_code, string user_name, string pass_word, string avatar_img, string full_name, string email, string mobile, bool gender, string company, string address, DateTime birth_day, string nick_chat, DateTime vip_start_time, DateTime vip_end_time, bool is_vip, bool is_activated, int total_deals, int total_comments, int total_sms, decimal total_money, DateTime first_logged_in, DateTime last_logged_in, bool is_locked, DateTime locked_date, string locked_by, string reason_locked, DateTime unlock_date, string unlock_by, string reason_unlock, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status) {
            try {
                usp_portal_members_update entity = new usp_portal_members_update();
                entity.MEMBER_ID = member_id;
                entity.REGION_ID = region_id;
                entity.MEMBER_CODE = member_code;
                entity.VERIFY_CODE = verify_code;
                entity.USER_NAME = user_name;
                entity.PASS_WORD = pass_word;
                entity.AVATAR_IMG = avatar_img;
                entity.FULL_NAME = full_name;
                entity.EMAIL = email;
                entity.MOBILE = mobile;
                entity.GENDER = gender;
                entity.COMPANY = company;
                entity.ADDRESS = address;
                entity.BIRTH_DAY = birth_day;
                entity.NICK_CHAT = nick_chat;
                entity.VIP_START_TIME = vip_start_time;
                entity.VIP_END_TIME = vip_end_time;
                entity.IS_VIP = is_vip;
                entity.IS_ACTIVATED = is_activated;
                entity.TOTAL_DEALS = total_deals;
                entity.TOTAL_COMMENTS = total_comments;
                entity.TOTAL_SMS = total_sms;
                entity.TOTAL_MONEY = total_money;
                entity.FIRST_LOGGED_IN = first_logged_in;
                entity.LAST_LOGGED_IN = last_logged_in;
                entity.IS_LOCKED = is_locked;
                entity.LOCKED_DATE = locked_date;
                entity.LOCKED_BY = locked_by;
                entity.REASON_LOCKED = reason_locked;
                entity.UNLOCK_DATE = unlock_date;
                entity.UNLOCK_BY = unlock_by;
                entity.REASON_UNLOCK = reason_unlock;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_members_update>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Delete(string ids, string spliter, int delete_type) {
            try {
                usp_portal_members_delete entity = new usp_portal_members_delete();
                entity.IDS = ids;
                entity.SPLITER = spliter;
                entity.DELETE_TYPE = delete_type;

                return BO_Actions<usp_portal_members_delete>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Restore(int member_id) {
            try {
                usp_portal_members_restore entity = new usp_portal_members_restore();
                entity.MEMBER_ID = member_id;

                return BO_Actions<usp_portal_members_restore>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectAdmin(string keywords, int startIndex, int pageCount, int status) {
            try {
                usp_portal_members_select_admin entity = new usp_portal_members_select_admin();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                entity.KEYWORDS = keywords;
                return BO_Actions<usp_portal_members_select_admin>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Active(int member_id, bool is_active) {
            try {
                usp_portal_members_active entity = new usp_portal_members_active();
                entity.MEMBER_ID = member_id;
                entity.IS_ACTIVATED = is_active;
                return BO_Actions<usp_portal_members_active>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Login(string username, string password) {
            try {
                usp_portal_members_login entity = new usp_portal_members_login();
                entity.USER_NAME = username;
                entity.PASS_WORD = password;
                return BO_Actions<usp_portal_members_login>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string ForgotPassword(string username, string email) {
            try {
                usp_portal_members_forgot_password entity = new usp_portal_members_forgot_password();
                entity.USER_NAME = username;
                entity.EMAIL = email;
                return BO_Actions<usp_portal_members_forgot_password>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string ChangePassword(string username, string password, string new_password) {
            try {
                usp_portal_members_change_password entity = new usp_portal_members_change_password();
                entity.USER_NAME = username;
                entity.PASSWORD = password;
                entity.NEW_PASSWORD = new_password;
                return BO_Actions<usp_portal_members_change_password>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Search(string user_name) {
            try {
                usp_portal_members_search_user_name entity = new usp_portal_members_search_user_name();
                entity.USER_NAME = user_name;
                return BO_Actions<usp_portal_members_search_user_name>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Update(int region_id, string user_name, string avatar_img, string full_name, string email, string mobile, string company, string address, string nick_chat, string tel, string website) {
            try {
                usp_portal_members_update_info entity = new usp_portal_members_update_info();
                entity.REGION_ID = region_id;
                entity.USER_NAME = user_name;
                entity.AVATAR_IMG = avatar_img;
                entity.FULL_NAME = full_name;
                entity.EMAIL = email;
                entity.MOBILE = mobile;
                entity.COMPANY = company;
                entity.ADDRESS = address;
                entity.NICK_CHAT = nick_chat;
                entity.TEL = tel;
                entity.WEBSITE = website;
                return BO_Actions<usp_portal_members_update_info>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
    }
}

